package day17;

import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-03-23 23:12
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        if(n<=2){
            System.out.println(-1);
            return;
        }
        if(n%2==1){
            System.out.println(2);
            return;
        }
        else{
            System.out.println(3+(n-4)/2);
            return;
        }
    }
}
